<?php
/**
 * Abstract class for the menu classes
 *
 * Copyright (C) 2008  Sean Hickey
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * @author Sean Hickey <sean@headzoo.com>
 * @version $Id: Abstract.php 382 2008-07-03 05:31:10Z sean $
 * @package Alinks_Menu
 */
abstract class Alinks_Menu_Abstract
{
	/**
	 * Any error message to show to the user
	 *
	 * @var string
	 */
	protected static $_error_msg = null;
	
	/**
	 * Success message to show to the user
	 *
	 * @var string
	 */
	protected static $_success_msg = null;
	
	/**
	 * The title of the success message to show to the user
	 *
	 * @var string
	 */
	protected static $_success_title = null;
	
	/**
	 * Gives the menu a chance to add any CSS or JS to the admin
	 * head
	 */
	public static function head()
	{
		include('AlinksMenus/Common/Head.php');
	}
	
	/**
	 * Gives the menu a chance to process submitted forms
	 */
	public static function init()
	{
	
	}
	
	/**
	 * Displays the menu
	 */
	public abstract static function show();
	
	/**
	 * Displays an admin notice to the user
	 *
	 * Called by the 'admin_notices' action.
	 */
	public static function adminNotices()
	{
		if (null !== self::$_error_msg) {
			$title = 'aLinks Error';
			$message = self::$_error_msg;
			$class = 'fade-ff0000';
		} else {
			$title = self::$_success_title;
			$message = self::$_success_msg;
			$class = 'fade';
		}
		?>
		<div id='alinks_notice' class='updated <?php echo $class; ?>'>
			<p><strong><?php echo $title; ?></strong> 
			<?php echo $message; ?></p>
		</div>
		<?php
	}
}